package org.example.Soution002;

public class findMin {
    public static void main(String[] args) {
        int[] nums=new int[]{3,1,2};
        findMin findMin=new findMin();
        System.out.println(findMin.findMinNum(nums));
    }

    public int findMinNum(int[] nums) {
        int start=0,end=nums.length-1;
        int min=Integer.MAX_VALUE;
        while(start<=end){
            int mid=start+(end-start)/2;
            min=Math.min(min,nums[mid]);
            if(nums[start]<nums[mid]&&nums[end]<nums[start]){
                start=mid+1;
            }else{
                end=mid-1;
            }
        }
        return min;
    }
}
